package com.xinhe.web.reposity;

import com.xinhe.web.entity.GoodsPrice;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Set;

public interface GoodsPriceRepository  extends JpaRepository<GoodsPrice, Long> {
    @Query(value = "select * from tb_goods_price where removed = 0 and f_goods_id =?1", nativeQuery = true)
    List<GoodsPrice> findGoodsPrice(Long goodsId);

    @Modifying
    @Query(value = "update tb_goods_price where removed = 1 and id in ?1", nativeQuery = true)
    void deleteByIdIn(Set<Long> collect);
}
